package common.window
{
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	
	import spark.components.TitleWindow;
	
	/**
	 * 因为TitleWindow组件拖动时，可以拖出浏览器外面，使窗口不能正常关闭，
	 * TitleWindowEx主要作用是修复这个bug.
	 **/
		public class TitleWindowEx extends TitleWindow
		{
			public function TitleWindowEx()
			{
				super();
			}
			
			override protected function moveArea_mouseDownHandler(event:MouseEvent):void
			{
				startDrag(false, new Rectangle(0, 0, this.parentApplication.width - this.width, this.parentApplication.height - this.height));
				super.moveArea_mouseDownHandler(event);
			}
			
			override protected function moveArea_mouseUpHandler(event:Event):void
			{
				stopDrag();
				super.moveArea_mouseUpHandler(event);
			}
			
		}
}